﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace FinanceAPI.Model
{
    /// <summary>
    /// 凭证预警表
    /// </summary>
    [Serializable]
    [Description("凭证预警表")]
    [Table("Pd_Vourcher_Warning")]
    public class PdEntityVourcherWarning : AggregateRoot
    {

        // public Guid VourcherWarningId { get; set; } = Guid.NewGuid();
        /// <summary>
        /// 集团代码
        /// </summary>
        [MaxLength(50)]
        public string GroupId { get; set; }

        /// <summary>
        /// 集团名称
        /// </summary>
        [MaxLength(50)]
        public string GroupName { get; set; }

        /// <summary>
        /// 公司代码
        /// </summary>
        [MaxLength(50)]
        public string CompanyCode { get; set; }

        /// <summary>
        /// 公司名称
        /// </summary>
        [MaxLength(50)]
        public string CompanyName { get; set; }

        /// <summary>
        /// 公司唯一代码
        /// </summary>
        [MaxLength(50)]
        public string CompanyUniqueId { get; set; }
        /// <summary>
        /// 凭证序列号
        /// </summary>
        [MaxLength(50)]
        public string VourcherSqNo { get; set; }

        /// <summary>
        /// 记账日期
        /// </summary>
        public DateTime PostingDate { get; set; }

        /// <summary>
        /// 业务日期
        /// </summary>
        public DateTime BusinessDate { get; set; }

        /// <summary>
        /// 录入时间
        /// </summary>
        public DateTime EntryDate { get; set; }

        /// <summary>
        /// 会计期间
        /// </summary>
        public int PostingPriod { get; set; }

        /// <summary>
        /// 凭证类型
        /// </summary>
        public string VourcherType { get; set; }

        /// <summary>
        /// 凭证号
        /// </summary>
        [MaxLength(50)]
        public string VourcherNo { get; set; }

        /// <summary>
        /// 分录号
        /// </summary>
        public int EntryNo { get; set; }

        /// <summary>
        /// 凭证摘要
        /// </summary>
        [MaxLength(500)]
        public string VourcherSummary { get; set; }

        /// <summary>
        /// 凭证科目
        /// </summary>
        [MaxLength(50)]
        public string VourcherSubject { get; set; }

        /// <summary>
        /// 科目名称
        /// </summary>
        [MaxLength(50)]
        public string SubjectName { get; set; }

        /// <summary>
        /// 货币
        /// </summary>
        [MaxLength(20)]
        public string Currency { get; set; }

        /// <summary>
        /// 汇率
        /// </summary>
        [MaxLength(20)]
        public string ExchangeRate { get; set; }

        /// <summary>
        /// 原币金额
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 借方金额
        /// </summary>
        public decimal AmountDebit { get; set; }

        /// <summary>
        /// 贷方金额
        /// </summary>
        public decimal AmountCredit { get; set; }

        /// <summary>
        /// 预警类型
        /// </summary>
        public WarningType? WarningType { get; set; }

        /// <summary>
        /// 预警信息
        /// </summary>
        [MaxLength(500)]
        public string VourcherContent { get; set; }

        /// <summary>
        /// 预警状态
        /// </summary>
        public WarningStatus WaringStatus { get; set; } = WarningStatus.Uncommitted;

        /// <summary>
        /// 预警金额
        /// </summary>
        public decimal WarningAmount { get; set; }
        /// <summary>
        /// 客户ID
        /// </summary>
        [MaxLength(100)]
        public string CustomerID { get; set; }
        /// <summary>
        /// 客户名称
        /// </summary>
        [MaxLength(100)]
        public string CustomerName { get; set; }
        /// <summary>
        /// 项目ID
        /// </summary>
        [MaxLength(100)]
        public string ProjectID { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        [MaxLength(100)]
        public string ProjectName { get; set; }

        /// <summary>
        /// 科目分类
        /// </summary>
        [MaxLength(100)]
        public string SujectType { get; set; }

        /// <summary>
        /// 流入资金
        /// </summary>
        public bool AmountFlow { get; set; }

        /// <summary>
        /// 大项目编码
        /// </summary>
        public string BigProjectCode { get; set; }

        /// <summary>
        /// 大项目名称
        /// </summary>
        public string BigProjectName { get; set; }

    }

    /// <summary>
    /// 预警类型
    /// </summary>
    public enum WarningType : byte
    {
        [Display(Name = "凭证预警")]
        Vourcher = 3,

        [Display(Name = "客户预警")]
        Customer = 2,

        [Display(Name = "项目预警")]
        Project = 1,
    }

    /// <summary>
    /// 预警状态
    /// </summary>
    public enum WarningStatus : byte
    {
        [Display(Name = "未提交")]
        Uncommitted = 0,

        [Display(Name = "未确定/待确认")]
        Unconfirmed = 1,

        [Display(Name = "已确认")]
        Confirmed = 2,
    }
}
